using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Bino.ExamOnline.Components.Service;
using Bino.ExamOnline.Components.Entitys;
using System.Collections.Generic;
using Bino.Common.TextLib;

namespace Bino.ExamOnline.Manage
{
    public partial class TeacherList : Bino.ExamOnline.Components.UI.PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            IList<Teacher> list = UserBLL.GetAllTeacher();
            GridView1.DataSource = list;
            GridView1.DataBind();
        }


        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int id = StringHelper.SafeInt(GridView1.Rows[e.NewEditIndex].Cells[0].Text.Trim(), -1);
            //GridView1.EditIndex = id;
            //BindData(false);
            Response.Redirect("TeacherEdit.aspx?id=" + id);
        }

        protected void btnInsert_Click(object sender, EventArgs e)
        {
            Response.Redirect("TeacherEdit.aspx?id=-1");
        }
    }
}
